package org.wheel.plugins.toolkit.sql.segment;

import lombok.Getter;
import org.wheel.plugins.toolkit.sql.core.AbstractWrapper;
import org.wheel.plugins.toolkit.sql.core.SqlSegment;
import org.wheel.plugins.toolkit.sql.enums.LogicalOp;


@Getter
public abstract class AbstractWhereSegment implements SqlSegment {
    // SQL 语句连接操作符 AND/OR
    private LogicalOp logicalOp;
    // 开始括号 判断条件
    private boolean beginBracket = false;
    // 结束括号 判断条件
    private boolean endBracket = false;
    private AbstractWrapper<?, ?> wrapper;

    public AbstractWhereSegment(LogicalOp logicalOp, AbstractWrapper<?, ?> wrapper){
        this.logicalOp = logicalOp;
        this.wrapper = wrapper;
    }

    public AbstractWhereSegment withBeginBracket(boolean beginBracket) {
        this.beginBracket = beginBracket;
        return this;
    }

    public AbstractWhereSegment withEndBracket(boolean endBracket) {
        this.endBracket = endBracket;
        return this;
    }

    public AbstractWhereSegment withLogicalOp(LogicalOp logicalOp) {
        this.logicalOp = logicalOp;
        return this;
    }
}
